using System;
using System.Runtime.Serialization;

namespace Test.MyUtils.TestHelp {
	[Serializable]
	public class TestAssertionException : Exception {
		public TestAssertionException() { }

		public TestAssertionException(string message)  :base(message) {
			_message = message;
		}

		public TestAssertionException(string message, Exception inner) :base(message,inner)
		{
			_message = message;
		}

		protected TestAssertionException(
			SerializationInfo info,
			StreamingContext context) : base(info, context) {}

		string _message;
		public override string Message {
			get {
				return _message ?? "Assertion Failed";
			}
		}

		public string SetMessage {
			set {
				if (value != null)
					_message = value;
				else
					throw new InvalidOperationException();
			}
		}

		public virtual TestResult TestResult {
			get {
				return TestResult.Fail;
			}
		}

	}
}